Macaulay2 » Documentation
Packages » Python » PythonObject » PythonObject ^ PythonObject
next | previous | forward | backward | up | index | toc

PythonObject ^ PythonObject -- exponentiation of Python objects

Description

Raise one Python object to the power of another.

i1 : (toPython 2)^(toPython 3)

o1 = 8

o1 : PythonObject of class int

In addition to the Macaulay2-style ^, this operation is also available using the Python-style **.

i2 : toPython 2 ** toPython 3

o2 = 8

o2 : PythonObject of class int

Note that parentheses were not necessary in the latter case since ** has much lower precedence than ^.

If one of the arguments is a Macaulay2 object, then it is first converted to a Python object before exponentiating.

i3 : (toPython 2)^3

o3 = 8

o3 : PythonObject of class int
i4 : 4^(toPython 5)

o4 = 1024

o4 : PythonObject of class int

Caveat

In Python, the ^ operator corresponds to the bitwise xor operation. We use ^^ in this case for consistency with the rest of Macaulay2.

See also

Menu

Ways to use this method:


The source of this document is in Python/doc/arithmetic.m2:777:0.